
*****************************************************************************
*
* Readme file for
*
* WHEN THE PARTISAN BECOMES PERSONAL: MAYORAL INCUMBENCY EFFECTS IN BUENOS AIRES
*
* By Germán Feierherd and Adrián Lucardi
*
* Journal of Elections, Public Opinion and Parties
*
* April 2022
*
*****************************************************************************


*****************************************************************************
* NOTE
*****************************************************************************

- All the analyses were carried out using R version 4.1.2 (2021-11-01) -- "Bird Hippie"
- The script was run on a Mac platform
- To replicate the results, you need to install and call the following packages and dependencies in R:
install.packages ("pacman")
install.packages ("dplyr")
install.packages ("fastDummies")
install.packages ("ggcorrplot")
install.packages ("ggplot2")
install.packages ("ggpmisc")
install.packages ("ggthemes")
install.packages ("gtools")
install.packages ("lfe")
install.packages ("lpdensity")
install.packages ("readxl")
install.packages ("rddensity")
install.packages ("rdrobust")
install.packages ("schoolmath")
install.packages ("sf")
install.packages ("stringr")
install.packages ("tidyr")
install.packages ("tidyverse")
install.packages ("viridis")
install.packages ("wesanderson")
install.packages ("xtable")




*****************************************************************************
* REPLICATION FILES
*****************************************************************************

1. "Resignation_LSQ_01_Monthly.R": script used to reproduce the bulk of the results, tables and figures reported in the paper. The only exceptions are Tables A9 and A10 in the online appendix. This also produces the LaTeX code for the corresponding tables, though you have to copy and paste it manually.


2. "Elecciones Municipales PBA 1973-2019.RData": municipality-year-party dataset. Electoral returns for every party in every municipal election in the Province of Buenos Aires between 1973 and 2019. Includes information for municipal-level elections only. Thus, this is the raw data from which most variables are derived, but NOT the main dataset included in the analysis.


3. "PBA 1973-2019_full.RData": municipality-year-party dataset, but with the sample restricted to (a) the "official" PJ or UCR list; in (b) elections in which either list finished in the first or second place only. Thus, third parties are not included, nor are unofficial PJ or UCR lists, nor the official PJ or UCR list when they finished in the third place or lower.

THIS IS THE MAIN DATASET USED FOR THE ANALYSIS. Used to replicate:
- Figure 2
- Figures A1 through A3
- Figures A6 through A10
- Table 1
- Tables A4 through A9

Additionally, in conjunction with (6) and (7), used to replicate:
- Table A3
- Table A10
- Table A11


4. "PBA_2011_2019.xlsx": municipality-mayor dataset. For each mayor elected in 2011 and 2015, this indicates whether he (a) sought reelection in 2015 and 2019, respectively; and (b) whether they were actually reelected. Used to replicate:
- Table A2


5. "secciones.xlsx": municipality-section identifier. In legislative elections in the Province of Buenos Aires, each municipality is grouped into one of eight multi-member districts. This file provides the municipality-district identifier.

Jointly, (3) and (5) are used to replicate:
- Figure A5


6. "copartisans.xlsx": for each election year between 1983 and 2019, this dataset identifies the party of the president and the national governor at times t; t+2; and t+4.


7. "EAD+2.0+quarter+101019.csv": Executive Approval Database 2.0. Executive approval data for presidents in different countries, by quarter. Source: Carlin, Ryan E., Jonathan Hartlyn, Timothy Hellwig, Gregory J. Love, Cecilia Martínez-Gallardo, and Matthew M. Singer. “Executive Approval Database 2.0,” 2019. http://www.executiveapproval.org/.

Together, (6) and (7) are used to replicate:
- Table A1


8. "cordones.csv": identifier of Conurbano/non-Conurbano status


9. "departamentos.zip": Shapefiles with municipality boundaries. 

Together, (3), (8) and (9) are used to replicate the maps:
- Figure 1
- Figure A4
